From: Keir Fraser Date: Thu, 8 Apr 2010 14:31:52 +0000 (+0100) Subject: Fix two issues for CPU online/offline. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12421 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=2293eaf330e8c2a53cca3a35209e4f31123cebe6;p=xen.git Fix two issues for CPU online/offline. Firstly, we should return if we fail to get spin lock in cpu_down. Secondly, in credit scheduler, the idlers need be limited only to online map. Signed-off-by: Jiang, Yunhong --- diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 96db89fc54..00c4300231 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -1343,10 +1343,8 @@ int cpu_down(unsigned int cpu) int err = 0; /* spin_trylock() avoids deadlock with stop_machine_run(). */ - if (!spin_trylock(&cpu_add_remove_lock)) { - err = -EBUSY; - goto out; - } + if (!spin_trylock(&cpu_add_remove_lock)) + return -EBUSY; if (num_online_cpus() == 1) { err = -EBUSY; diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 11d26421e0..e09e03da68 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -428,7 +428,7 @@ _csched_cpu_pick(struct vcpu *vc, bool_t commit) * like run two VCPUs on co-hyperthreads while there are idle cores * or sockets. */ - idlers = csched_priv.idlers; + cpus_and(idlers, cpu_online_map, csched_priv.idlers); cpu_set(cpu, idlers); cpus_and(cpus, cpus, idlers); cpu_clear(cpu, cpus);